<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let gcd = (a, b) => {
      return b == 0 ? a : gcd(b, a % b)
    }
    var canMeasureWater = function (x, y, z) {
      if (z == 0) return true
      if (x + y < z) return false
      if (x == 0 || y == 0) return (x + y) == z

      return z % gcd(y, x) == 0
    };
    console.log(canMeasureWater(x = 2, y = 6, z = 5))
  </script>
</body>

</html>